<div class="hbox hbox-auto-xs hbox-auto-sm" ng-init="
    app.settings.asideFolded = false;
    app.settings.asideDock = false;
  ">
    <!-- main -->
    <div class="col">
        <!-- main header -->
        <div class="bg-light lter b-b wrapper-md">
            <div class="row">
                <div class="col-sm-6 col-xs-12">
                    <h1 class="m-n font-thin h3 text-black">阿里云RAM策略</h1>
                    <small class="text-muted">Policy管理</small>
                </div>
            </div>
        </div>
        <!-- / main header -->
        <div class="wrapper-md">
            <!-- toaster directive -->
            <toaster-container
                    toaster-options="{'position-class': 'toast-top-right', 'close-button':true}"></toaster-container>
            <!-- / toaster directive -->

            <div class="panel panel-default" ng-controller="aliyunRamPolicyCtrl">
                <div class="panel-body">

                    <form class="form-inline" role="form">
                        <div class="form-group">
                            <div class="input-group">
                                <span class="input-group-addon">策略名称</span>
                                <input type="text" class="form-control" ng-model="queryName" placeholder="Policy名称">
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="input-group">
                                <span class="input-group-addon">描述</span>
                                <input type="text" class="form-control" ng-model="queryDescription"
                                       placeholder="Description">
                            </div>
                        </div>
                        <div class="form-group">
                            <button type="button" class="btn btn-info" ng-click="queryPolicy()"><span
                                    class="glyphicon glyphicon-search"></span>搜索
                            </button>
                            <button type="button" class="btn btn-info" ng-click="reSet()"><span
                                    class="glyphicon glyphicon-repeat"></span>重置
                            </button>
                            <button type="button" class="btn btn-success" ng-click="updatePolicy()">
                                <i class="fa fa-spin fa-spinner" ng-show="butUpdatePolicy"></i>
                                <i class="glyphicon glyphicon-repeat" ng-show="!butUpdatePolicy"></i>同步阿里云策略
                            </button>
                        </div>
                    </form>

                    <div class="panel panel-default" style="margin-top: 5px;;">
                        <div class="panel-body">
                            <div>
                                <table class="table table-hover table-bordered table-striped">
                                    <thead>
                                    <tr>
                                        <td>策略名称</td>
                                        <td>描述</td>
                                        <td>类型</td>
                                        <td>版本</td>
                                        <td>允许授权</td>
                                        <td>创建时间</td>
                                        <td>操作</td>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <tr ng-repeat="item in pageData">
                                        <td>
                                            <b style="color: #2b669a">{{item.policyName}}</b>
                                        </td>
                                        <td>
                                            <b style="color: #777">{{item.description}}</b>
                                        </td>
                                        <td>
                                            <b style="color: #ff5f87" ng-show="item.policyType == 'Custom'">自定义</b>
                                            <b style="color: #20a03f" ng-show="item.policyType == 'System'">系统</b>
                                        </td>
                                        <td>
                                            <b style="color: #777">{{item.defaultVersion}}</b>
                                        </td>
                                        <td>
                                            <b style="color: #20a03f" ng-show="item.allows">允许</b>
                                            <b style="color: #c9302c" ng-show="!item.allows">禁止</b>
                                        </td>
                                        <td>{{(item.gmtModify == null || item.gmtModify == '') ? item.gmtCreate
                                            : item.gmtModify}}
                                        </td>
                                        <td>
                                            <button ng-click="setAllows(item.id)"
                                                    ng-show="!item.allows"
                                                    class="btn btn-xs"
                                                    style="background-color: #20a03f; color: white;">
                                                <span class="glyphicon glyphicon-ok"></span>允许授权
                                            </button>
                                            <button ng-click="setAllows(item.id)"
                                                    ng-show="item.allows"
                                                    class="btn btn-xs"
                                                    style="background-color: #c9302c; color: white;">
                                                <span class="glyphicon glyphicon-remove"></span>禁止授权
                                            </button>
                                        </td>
                                    </tr>
                                    </tbody>
                                    <tfoot>
                                    <tr>
                                        <td colspan="9">
                                            <ul style="margin: 0px; float: right;" uib-pagination
                                                total-items="totalItems" ng-model="currentPage"
                                                items-per-page="pageLength" max-size="10"
                                                ng-change="pageChanged()" previous-text="&lsaquo;"
                                                next-text="&rsaquo;"></ul>
                                        </td>
                                    </tr>
                                    </tfoot>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>


        </div>
    </div>
    <!-- / main -->
</div>
